(function() {
	window._v={
			processNoData:function($jqtpl, json){
				if(json.c!=0){
	        		var colspan = $jqtpl.closest("table").children("thead").children().length;
		       		 $jqtpl.after("<tr class='v-new-row'><td colspan='"+colspan+"'>"+json.m+"</td></tr>");
	        		 return true;
	        	}
	        	if(!json.d||json.d.length==0){
	        		var colspan = $jqtpl.closest("table").children("thead").children().length;
	        		$jqtpl.after("<tr class='v-new-row'><td colspan='"+colspan+"' style='color:red'>没有数据... ...</td></tr>");
	        		return true;
	        	}
				return false;
			},
			
			getParam:function(name){
			    var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
			    var r = window.location.search.substr(1).match(reg);
			    if(r!=null)return  unescape(r[2]); return null;
			},
			formatDate:function(pattern,date){
				var o = {
						"M+": date.getMonth() + 1, //month
						"d+": date.getDate(), //day
						"H+": date.getHours(), //hour
						"m+": date.getMinutes(), //minute
						"s+": date.getSeconds(), //second
						"q+": Math.floor((date.getMonth() + 3) / 3), //quarter
						"S": date.getMilliseconds() //millisecond
					}

					if (/(y+)/.test(pattern)) {
						pattern = pattern.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
					}

					for (var k in o) {
						if (new RegExp("(" + k + ")").test(pattern)) {
							pattern = pattern.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
						}
					}
					return pattern;
			},
			darken:function(color,persent){
				var usePound = false;
				if (color[0] == "#") {
					color = color.slice(1);
					usePound = true;
				}
				var num = parseInt(color, 16);
				var r = Math.floor((num >> 16) /persent);
				if (r > 255) {
					r = 255;
				} else if (r < 0) {
					r = 0;
				}
				var b =  Math.floor(((num >> 8) & 0x00FF) /persent);
				if (b > 255) {
					b = 255;
				} else if (b < 0) {
					b = 0;
				}
				var g = Math.floor((num & 0x0000FF) /persent);
				if (g > 255) {
					g = 255;
				} else if (g < 0) {
					g = 0;
				}
				return (usePound ? "#" : "") + (g | (b << 8) | (r << 16)).toString(16);
			}
	}
}.call(this));


if ( typeof define === "function") {
	define( "_v", [], function () { return _v; } );
}

